<?php
/* Lấy thông tin module */
$modules = new Pick_Core_Modules();
$opinfo  = $modules->getObjectFromCode($op);

# Check permision for module...
if(is_object($opinfo)){
    $op = $opinfo->getField('code'); // Đưa slug or code ve cung mot dang code
}else{
    $userTemplate = DEFAULT_TEMPLATE;
    $op = "error";	
}
// Init module
$nameModule = $op."Module";
$objModule = new $nameModule();
$themeForModule = "";
$layoutForModule = "";
if(is_object($opinfo)){
	$themeForModule = $opinfo->getField("theme");
	$layoutForModule = $opinfo->getField("layout");
}
if($themeForModule != ""){
	$objModule->setTheme($themeForModule);	
}
if($layoutForModule != ""){
	$objModule->setLayout($layoutForModule);	
}
$objModule->run();
unset($modules);
unset($opinfo);
unset($objModule);